var __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (r, a) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, r) {
              t.__proto__ = r;
            }) ||
          function (t, r) {
            for (var a in r)
              Object.prototype.hasOwnProperty.call(r, a) && (t[a] = r[a]);
          })(r, a);
      };
      return function (r, a) {
        function e() {
          this.constructor = r;
        }
        if ("function" != typeof a && null !== a)
          throw new TypeError(
            "Class extends value " + String(a) + " is not a constructor or null"
          );
        t(r, a),
          (r.prototype =
            null === a
              ? Object.create(a)
              : ((e.prototype = a.prototype), new e()));
      };
    })(),
  GangWarsManagerView = (function (t) {
    function r() {
      var r = t.call(this) || this;
      return (
        (r.listArr = []),
        r.btn_gangWar_mgr_back.on(Laya.Event.CLICK, r, r.onGangWarsDataBack),
        WebSocketService.addListener({
          caller: r,
          code: 1540,
          method: r.onLoadGangWarsAllHistoryDataFn,
        }),
        WebSocketService.addListener({
          caller: r,
          code: 1529,
          method: r.onLoadGangWarsAllHistoryDataFn,
        }),
        r
      );
    }
    return (
      __extends(r, t),
      (r.showGangWarsMgrView = function (t) {
        return (
          null == this.gangwarsMgrV && (this.gangwarsMgrV = new r()),
          "jinjisai" == t.type
            ? WebSocketService.send({
                c: 1529,
                d: { i: t.zgs_id, id: t.bangpaiId, pageNum: 0 },
              })
            : "juesai" == t.type &&
              WebSocketService.send({
                c: 1540,
                d: { id: t.bangpaiId, pageNum: 0 },
              }),
          (this.gangwarsMgrV.label_gangwar_mgr_title.text = t.title + "记录"),
          (this.gangwarsMgrV.list_gangWar_mgr.visible = !1),
          this.gangwarsMgrV
        );
      }),
      (r.prototype.onLoadGangWarsAllHistoryDataFn = function (t) {
        if (0 == t.code) {
          this.listArr = [];
          var r = void 0;
          if (this.currentPage >= 1) {
            if (0 == t.list.length) return void this.currentPage--;
            for (var a = 0; a < t.list.length; a++) {
              var e = t.list[a];
              this.listArr.push(e), (this.dataSource = []);
            }
          } else (this.listArr = t.list), (this.dataSource = []);
          this.listArr.length > 0
            ? (this.list_gangWar_mgr.visible = !0)
            : (this.list_gangWar_mgr.visible = !1),
            (this.isloading = !1);
          for (var i = 0; i < this.listArr.length; i++) {
            var n = this.listArr[i];
            (r = {
              label_wars_jifen: { text: n.n + " (获胜 " + n.c + " 次)" },
            }),
              this.dataSource.push(r);
          }
          this.list_gangWar_mgr.dataSource = this.dataSource;
        }
      }),
      (r.prototype.onGangWarsDataBack = function () {
        this.removeSelf();
      }),
      r
    );
  })(ui.ChallengeBattle.GangWarsManagerViewUI);
